﻿using Model;
using Smobiler.Core;
using Smobiler.Core.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FubiManger.Controls
{
    ////ToolboxItem用于控制是否添加自定义控件到工具箱，true添加，false不添加
    //[System.ComponentModel.ToolboxItem(true)]
    partial class activitycontrol : Smobiler.Core.Controls.MobileUserControl
    {
        public activitycontrol() : base()
        {
            //This call is required by the SmobilerUserControl.
            InitializeComponent();
        }
        /// <summary>
        /// 封面
        /// </summary>
        public string cover { get; set; }
        /// <summary>
        /// 商户ID
        /// </summary>
        public string merchantid { get; set; }
        /// <summary>
        /// 活动ID
        /// </summary>
        public string actid { get; set; }
        /// <summary>
        /// 商品名称
        /// </summary>
        public string goodname { get; set; }
        /// <summary>
        /// 1秒杀2拼团
        /// </summary>
        public string activity_type { get; set; }
        /// <summary>
        /// 市场价
        /// </summary>
        public double markprice { get; set; }
        /// <summary>
        /// 活动价
        /// </summary>
        public double disprice { get; set; }
        /// <summary>
        /// 销量
        /// </summary>
        public int sale { get; set; }
        /// <summary>
        /// 活动时间
        /// </summary>
        public DateTime date { get; set; }
        /// <summary>
        /// 成员人数
        /// </summary>
        public int group_num { get; set; }
        /// <summary>
        /// 商品
        /// </summary>
        public Gdpro pro { get; set; }
        private void panpart_Press(object sender, EventArgs e)
        {

        }

        private void activitycontrol_Load(object sender, EventArgs e)
        {
            imgcover.ResourceID = @"C:\fbimage\" + cover;//封面
            lblgoodname.Text = goodname;//商品名称
            lblbmoney.Text = "￥" + markprice.ToString();//市场价
            lblmoney.Text = disprice.ToString() + " ";//活动价
            lbltime.Text = date.Hour + ":" + date.Minute + ":" + date.Second + " 开始";//活动时间
            if (activity_type == "2")
            {
                panproger.Visible = true;
                if (sale > 0 && group_num > 0)
                    prgs.Value = (float)sale / group_num;
                lbltype.Text = "拼团";
                lblcount.Visible = true;
                lblcount.Text = sale + "/" + group_num;
            }
            else
            {
                panproger.Visible = false;
                lblcount.Visible = false;
                lbltype.Text = "秒杀";
            }
        }
    }
}